import * as API from "@/services";

const useNewsAnalyze = (news: API.FrontNews) => {
  let linkUrl: undefined | string = undefined;
  let isExternal = false;
  if (news.link) {
    linkUrl = news.link;
    isExternal = true;
  } else {
    linkUrl = `/news/${news.id}`;
    if (!!news.journalId) {
      linkUrl = `/journal/${news.journalId}${linkUrl}`;
    }
  }
  return {
    linkUrl,      //链接地址
    isExternal    //是否外站链接
  }
}

export default useNewsAnalyze;
